const graph = require('./common-graph')

const visited = new Set()
const q = [2]
visited.add(2)
while(q.length) {
  const n = q.shift()
  console.log(n)
  graph[n].forEach(key => {
    !visited.has(key) && q.push(key)
    visited.add(key)
  })
}